package com.kgc.service.edu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kgc.service.edu.entity.Video;
import com.kgc.service.edu.mapper.VideoMapper;
import com.kgc.service.edu.service.VideoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 课程视频 服务实现类
 * </p>
 *
 * @author qf
 * @since 2021-03-07
 */
@Service
public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements VideoService {

    @Override
    public boolean delVideoById(String id) {
        boolean del;
        del=this.removeById(id);
        return del;
    }

    @Override
    public boolean delVideoByChapterId(String id) {
        QueryWrapper<Video> wrapper = new QueryWrapper<>();
        wrapper.eq("chapter_id", id);
        return this.remove(wrapper);
    }

    @Override
    public boolean removeVideoByCourseId(String id) {
        QueryWrapper<Video> wrapper = new QueryWrapper<>();
        wrapper.eq("course_id", id);
        return this.remove(wrapper);

    }
}
